/*
 	Tool for Path Finding Algorithm Testing (ToPFAT) 
 	
    Copyright (C) 2009, Teemu Turunen and Arttu Viljakainen 
    Published under GNU General Public License V3 
    (see http://www.gnu.org/licenses/licenses.html)
    
    This file is part of Tool for Path Finding Algorithm Testing.

    Tool for Path Finding Algorithm Testing is free software: you can 
    redistribute it and/or modify it under the terms of the GNU General 
    Public License as published by the Free Software Foundation, 
    either version 3 of the License, or (at your option) any later version.

    Tool for Path Finding Algorithm Testing is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
    Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Tool for Path Finding Algorithm Testing. If not, see         <http://www.gnu.org/licenses/>.
 */

package graph;

import java.awt.Point;

public class Node {
	
	private Point location;
	private LinkedNodeList<? extends Node> neighbours;
	private int type;

	public Node(Point location) {
		this.location = location;
		type = 0;
		neighbours = new LinkedNodeList<Node>();
	}
	
	public Node(Point location, int type) {
		this.location = location;
		this.type = type;
		neighbours = new LinkedNodeList<Node>();
	}
	
	public void addNeighbour(Node neighbour) {
		neighbours.add(neighbour);
	}
	
	public LinkedNodeList<? extends Node> getNeighbours() {
		return neighbours;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Point getLocation() {
		return location;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(! (obj instanceof Node)) 
			return false;
		
		return ((Node)obj).getLocation().equals(location);
	}
	
	@Override
	public int hashCode() {
		return this.location.hashCode();
	}
	
}
